<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.css" rel="stylesheet" />
		<script src="../js/mui.js"></script>
		<script type="text/javascript">
			mui.init()
		</script>
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
	</head>
	<style>
		body {
			background-color: white;
		}

		.p1 {
			padding-top: 0.625rem;
			width: 100%;
			display: flex;
			justify-content: space-between;
		}

		.p2 {
			font-size: 16px;
			text-indent: 15px;
			padding: 11px 15px;
		}
	</style>
	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">文章内容</h1>
		</header>
		<div class="mui-content">
			<ul class="mui-table-view ui_ul" style="margin-top: 0px;">
				<!-- <li class="mui-table-view-cell">
					<h3>123123123</h3>
					<p class="p1">123<span class="spn1">阅读次数:0</span></p>
				</li> -->
			</ul>
			<div id="content"></div>
		</div>
	</body>
	<script>
		const urlParams = new URLSearchParams(window.location.search);
		const id = urlParams.get("id"); // 获取当前页面id值

		// 获取详情页内容
		mui.ajax('http://192.168.0.111:3000/refers/re', {
			dataType: 'json', //服务器返回json格式数据
			type: 'get', //HTTP请求类型	              
			success: function(res) {
				let data = res.data // 后添加数据
				let arr = data.slice(0, 4)
				let newarr = data.slice(4)
				arr.forEach(item => {
					if (id == item.id) {
						let module = `
							<li class="mui-table-view-cell">
								<h4>${item.title}</h4>
								<p class="p1">${item.time}<span class="spn1">阅读次数:${item.number ?item.number:0}</span></p>
							</li>
						`
						$('.ui_ul').append(module)
						let module1 = `
						<span style="text-align:center; display:block; width:100%;">${item.content_title}</span>
						<p class="p2">${item.content1}</p>
						<p class="p2">${item.content1_text}</p>
						<p class="p2">${item.content3}</p>
						<p class="p2">${item.content3_text}</p>
						`
						$('#content').append(module1)
					}
				})
				newarr.forEach(item => {
					console.log(id == item.id);
					if (id == item.id) {
						let module1 = `
					<p class="p2">[下载文件]:53M</p>
					<p class="p2">[下载链接]:https://pan.baidu.com/s/1cfdEuvxZXGZBJ9okpx34sA</p>
					<p class="p2">[提取码]:dsix</p>
					<p class="p2">[下载方法]:方法1：复制下载链接后打开手机/电脑网页，输入提取码，按步骤操作即可下载。</p>
					`
						$('#content').append(module1)
					}
				})
			},
			error: function(xhr, type, errorThrown) {
				//异常处理；
				console.log(type);
			}
		});
	</script>
</html>